var express = require('express')
var router = express.Router()
const {readEach, consoleInfo, joinRootDir}= require("../../util.js")

router.get("/",(req,res)=>{
    res.send("/")
})
router.get("/pagesInfo",(req,res)=>{  //返回所有单页目录名
    consoleInfo(req,"get: pagesInfo")
    var server= req.protocol + "://" + req.headers.host
    var arr= readEach(joinRootDir("./public/singlePages"),'dir').map(v=>({
        title: v,
        path: server + "/public/singlePages/"+v,
        img: server + "/public/singlePages/"+v+"/logo.png",
    }))
    res.send(arr)
})
module.exports = router;